import request from '@/utils/request'

const rechargePackApi = {
    /**
     * 充值套餐列表
     */
    lists(): Promise<any> {
        return request.get({
            url: '/market/recharge/lists'
        })
    },

    /**
     * 充值套餐详情
     */
    detail(id: number): Promise<any> {
        return request.get({
            url: '/market/recharge/detail',
            params: { id }
        })
    },

    /**
     * 充值套餐新增
     */
    add(params: {
        name: string;
        tags?: string;
        sell_price: number;
        line_price: number;
        points_num?: number;
        train_num?: number;
        robot_num?: number;
        know_num?: number;
        mcp_num?: number;
        sort?: number;
        is_disable?: number;
    }): Promise<any> {
        return request.post({
            url: '/market/recharge/add',
            params
        })
    },

    /**
     * 充值套餐编辑
     */
    edit(params: {
        id: number;
        name: string;
        tags?: string;
        sell_price: number;
        line_price: number;
        points_num?: number;
        train_num?: number;
        robot_num?: number;
        know_num?: number;
        mcp_num?: number;
        sort?: number;
        is_disable?: number;
    }): Promise<any> {
        return request.post({
            url: '/market/recharge/edit',
            params
        })
    },

    /**
     * 充值套餐删除
     */
    delete(id: number): Promise<any> {
        return request.post({
            url: '/market/recharge/delete',
            params: { id }
        })
    },

    /**
     * 充值配置读取
     */
    getConfig(): Promise<any> {
        return request.get({
            url: '/market/recharge/get_config'
        })
    },

    /**
     * 充值配置修改
     */
    setConfig(params: {
        status: number
    }): Promise<any> {
        return request.post({
            url: '/market/recharge/set_config',
            params
        })
    }
}

export default rechargePackApi
